<html>
  <head>
    <title><%= I18n.t('vanity.report', :timestamp=>I18n.l(Time.now, :format=>'%b %d %Y, %I:%M:%P')) %></title>
    <style>
      .vanity { margin: 2em auto; width: 40em; font-family: "Helvetica Neue", "Helvetica", "Verdana", sans-serif }
      .vanity h1 { margin: 1em 0; border-bottom: 3px solid #ccc }
      <%= vanity_html_safe(File.read(Vanity.template("vanity.css"))) %>
    </style>
    <script type="text/javascript"><%= vanity_html_safe(File.read(Vanity.template("jquery.min.js"))) %></script>
    <script type="text/javascript"><%= vanity_html_safe(File.read(Vanity.template("flot.min.js"))) %></script>
    <script type="text/javascript"><%= vanity_html_safe(File.read(Vanity.template("vanity.js"))) %></script>
    <% if respond_to?(:form_authenticity_token) %><script type="text/javascript">document.auth_token = "<%= form_authenticity_token %>"</script><% end %>
  </head>
  <body>
    <div class="vanity">
      <% unless Vanity.playground.collecting? %>
        <div class="alert collecting">
          <%= I18n.t('vanity.not_collecting_data', :setting=>"<span style='font-family: courier'>Vanity.playground.collecting = true;</span>", :file=>"<span style='font-family: courier'>config/environments/[environment].rb</span>").html_safe %>
        </div>
      <% end %>

      <% if experiments_persisted %>
        <% if experiments.present? %>
          <h2><%= I18n.t 'vanity.experiments' %></h2>
          <%= render :file=>Vanity.template("_experiments"), :locals=>{:experiments=>experiments} %>
        <% end %>

        <% unless metrics.empty? %>
          <h2><%= I18n.t 'vanity.metrics' %></h2>
          <%= render :file=>Vanity.template("_metrics"), :locals=>{:metrics=>metrics, :experiments=>experiments} %>
        <% end %>
      <% else %>
        <div class="alert persistance">
          <%= I18n.t 'vanity.experiments_out_of_sync' %>
        </div>
      <% end %>

      <p class="footer"><%= I18n.t('vanity.generated_by', :link=>'<a href="http://vanity.labnotes.org">Vanity</a>').html_safe %></p>
    </div>
  </body>
</html>
